home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / dos / makedosentry.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  94 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: makedosentry.c,v 1.5 1996/10/24 15:50:32 aros Exp $
  4.     $Log: makedosentry.c,v $
  5.     Revision 1.5  1996/10/24 15:50:32  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/10/10 13:20:50  digulla
  9.     Use dol_DevName(STRPTR) instead of dol_Name(BSTR) (Fleischer)
  10.  
  11.     Revision 1.3  1996/08/13 13:52:49  digulla
  12.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  13.     Replaced AROS_LA by AROS_LHA
  14.  
  15.     Revision 1.2  1996/08/01 17:40:54  digulla
  16.     Added standard header for all files
  17.  
  18.     Desc:
  19.     Lang: english
  20. */
  21. #include <exec/memory.h>
  22. #include <clib/exec_protos.h>
  23. #include "dos_intern.h"
  24.  
  25. /*****************************************************************************
  26.  
  27.     NAME */
  28.     #include <clib/dos_protos.h>
  29.  
  30.     AROS_LH2(struct DosList *, MakeDosEntry,
  31.  
  32. /*  SYNOPSIS */
  33.     AROS_LHA(STRPTR, name, D1),
  34.     AROS_LHA(LONG,   type, D2),
  35.  
  36. /*  LOCATION */
  37.     struct DosLibrary *, DOSBase, 116, Dos)
  38.  
  39. /*  FUNCTION
  40.     Create an entry for the dos list. Depending on the type this may
  41.     be a device a volume or an assign node.
  42.  
  43.     INPUTS
  44.     name - pointer to name
  45.     type - type of list entry to create
  46.  
  47.     RESULT
  48.  
  49.     NOTES
  50.  
  51.     EXAMPLE
  52.  
  53.     BUGS
  54.  
  55.     SEE ALSO
  56.  
  57.     INTERNALS
  58.  
  59.     HISTORY
  60.     29-10-95    digulla automatically created from
  61.                 dos_lib.fd and clib/dos_protos.h
  62.  
  63. *****************************************************************************/
  64. {
  65.     AROS_LIBFUNC_INIT
  66.     AROS_LIBBASE_EXT_DECL(struct DosLibrary *,DOSBase)
  67.  
  68.     STRPTR s2, s3;
  69.     struct DosList *dl;
  70.  
  71.     dl=(struct DosList *)AllocMem(sizeof(struct DosList),MEMF_PUBLIC|MEMF_CLEAR);
  72.     if(dl!=NULL)
  73.     {
  74.     s2=name;
  75.     while(*s2++)
  76.         ;
  77.     s3=(STRPTR)AllocMem(s2-name+1,MEMF_PUBLIC);
  78.     if(s3!=NULL)
  79.     {
  80.         /* Compatibility */
  81.         dl->dol_OldName=MKBADDR(s3);
  82.         *s3++=s2-name>256?255:s2-name-1;
  83.  
  84.         CopyMem(name,s3,s2-name);
  85.         dl->dol_DevName=s3;
  86.         dl->dol_Type=type;
  87.         return dl;
  88.     }
  89.     FreeMem(dl,sizeof(struct DosList));
  90.     }
  91.     return NULL;
  92.     AROS_LIBFUNC_EXIT
  93. } /* MakeDosEntry */
  94.